﻿//---------------------------------------------------------------------------
// <copyright file="MostRecentFileSelectedEventArgs.cs" company="Microsoft Corporation">
//     Copyright (C) Microsoft Corporation.  All rights reserved.
// </copyright>
//---------------------------------------------------------------------------

namespace Microsoft.Windows.Controls.Ribbon
{
    using System;
    using System.Windows;
 
    /// <summary>
    ///   A delegate for a MostRecentFileSelectedEventHandler.
    /// </summary>
    /// <param name="sender">The sender of the event.</param>
    /// <param name="e">The event data.</param>
    public delegate void MostRecentFileSelectedEventHandler(object sender, MostRecentFileSelectedEventArgs e);

    /// <summary>
    ///   Arguments for a MostRecentFileSelectedEventHandler.
    /// </summary>
    public class MostRecentFileSelectedEventArgs : RoutedEventArgs
    {
        /// <summary>
        ///   Initializes a new instance of the MostRecentFileSelectedEventArgs class.
        /// </summary>
        /// <param name="routedEvent">The RoutedEvent that these arguments are associated with.</param>
        /// <param name="source">The source of the event.</param>
        /// <param name="selectedItem">The selected item.</param>
        public MostRecentFileSelectedEventArgs(RoutedEvent routedEvent, object source, object selectedItem)
            : base(routedEvent, source)
        {
            this.SelectedItem = selectedItem;
        }

        /// <summary>
        ///   Gets the SelectedItem associated with these arguments.
        /// </summary>
        public object SelectedItem
        {
            get;
            private set;
        }

        /// <summary>
        ///   Provides a way to invoke event handlers in a type-specific way for MostRecentFileSelectedEvents.
        /// </summary>
        /// <param name="genericHandler">The generic handler / delegate implementation to be invoked.</param>
        /// <param name="genericTarget">The target on which the provided handler should be invoked.</param>
        protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget)
        {
            MostRecentFileSelectedEventHandler handler = (MostRecentFileSelectedEventHandler)genericHandler;
            handler(genericTarget, this);
        }
    }
}